package com.lagou.controller;

import com.lagou.service.HelloService;
import com.lagou.util.IPUtil;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
public class TestController {

    @Reference
    HelloService helloService;


    @RequestMapping("/test")
    public String test(HttpServletRequest request, HttpServletResponse response){
        String ipAddr = IPUtil.getIpAddr(request);
        helloService.sayHello(ipAddr);
        return ipAddr;
    }
}
